import { computed } from "vue";
import { useAuthStore } from "@/stores/modules/auth";

/**
 * @description 用户权限
 * */
export const useAuthPermissions = () => {
  const authStore = useAuthStore();
  const authPermissions = authStore.authPermissionListGet || [];

  // 用户权限计算属性
  const PERMISSIONS = computed(() => {
    let authPermission: { [key: string]: boolean } = {};
    authPermissions.forEach(item => (authPermission[item.permission] = true));
    return authPermission;
  });

  return {
    PERMISSIONS
  };
};
